package com.kzj.controller;

import com.kzj.myJar.common.result.Result;
import org.springframework.ai.ollama.OllamaChatClient;
import org.springframework.ai.openai.OpenAiChatClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ai")
public class AiController {
    @Autowired
    OpenAiChatClient openAiChatClient;
    @Autowired
    OllamaChatClient ollamaChatClient;
    @PostMapping("/ollama")
    public Result inquiryOllama(String msg){
        String call = ollamaChatClient.call(msg);
        return Result.success(call);
    }
    @PostMapping("/gpt")
    public Result inquiryGpt(String msg){
        String call=openAiChatClient.call(msg);
        return Result.success(call);
    }

}
